{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "910ebdc2",
   "metadata": {},
   "source": [
    "## 1. Init spark with CarbonExtensions"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "f73459bd",
   "metadata": {},
   "outputs": [],
   "source": [
    "from pyspark.sql import SparkSession\n",
    "spark = SparkSession.builder.enableHiveSupport().config(\"spark.sql.extensions\", \"org.apache.spark.sql.CarbonExtensions\").getOrCreate()"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "b73232b2",
   "metadata": {},
   "source": [
    "## 2. Create CarbonData table and insert data by using spark sql"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "d458dc3a",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "++\n",
      "||\n",
      "++\n",
      "++\n",
      "\n",
      "+---------+\n",
      "|namespace|\n",
      "+---------+\n",
      "|  default|\n",
      "+---------+\n",
      "\n",
      "+--------+------------------+-----------+\n",
      "|database|         tableName|isTemporary|\n",
      "+--------+------------------+-----------+\n",
      "| default|  carbondata_table|      false|\n",
      "| default|carbondata_table_v|      false|\n",
      "+--------+------------------+-----------+\n",
      "\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "DataFrame[Segment ID: string]"
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "spark.sql(\"DROP TABLE IF EXISTS carbondata_table_v\").show()\n",
    "spark.sql(\"CREATE TABLE IF NOT EXISTS carbondata_table_v( id INT,age INT,salary INT) USING carbondata\")\n",
    "spark.sql(\"show databases\").show()\n",
    "spark.sql(\"show tables\").show()\n",
    "spark.sql(\"LOAD DATA LOCAL INPATH '/home/jovyan/sample_data_simple.csv' into table carbondata_table_v options('header'='True')\")"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "edfc1eeb",
   "metadata": {},
   "source": [
    "## 3. Select data from CarbonData table"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "2c234b64",
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "+---+---+------+\n",
      "| id|age|salary|\n",
      "+---+---+------+\n",
      "|  1| 23| 66823|\n",
      "|  2| 23|198373|\n",
      "|  3| 64| 82938|\n",
      "|  4| 20| 55245|\n",
      "|  5| 35| 67660|\n",
      "|  6| 29| 56483|\n",
      "|  7| 56|173354|\n",
      "|  8| 58| 64758|\n",
      "|  9| 27|171463|\n",
      "| 10| 43|197818|\n",
      "| 11| 28|172165|\n",
      "| 12| 44| 62913|\n",
      "| 13| 33|113427|\n",
      "| 14| 25| 71427|\n",
      "| 15| 51|115963|\n",
      "| 16| 19| 82024|\n",
      "| 17| 41|141233|\n",
      "| 18| 26|100990|\n",
      "| 19| 46|144365|\n",
      "| 20| 27|133994|\n",
      "+---+---+------+\n",
      "only showing top 20 rows\n",
      "\n"
     ]
    }
   ],
   "source": [
    "spark.sql(\"SELECT * FROM carbondata_table_v\").show()"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "c5df896b",
   "metadata": {},
   "source": [
    "## 4. Describe the CarbonData table"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "ac65cba3",
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "+--------------------+--------------------+-------+\n",
      "|            col_name|           data_type|comment|\n",
      "+--------------------+--------------------+-------+\n",
      "|                  id|                 int|   null|\n",
      "|                 age|                 int|   null|\n",
      "|              salary|                 int|   null|\n",
      "|                    |                    |       |\n",
      "|## Detailed Table...|                    |       |\n",
      "|            Database|             default|       |\n",
      "|               Table|  carbondata_table_v|       |\n",
      "|               Owner|              jovyan|       |\n",
      "|             Created|Sat Apr 15 17:23:...|       |\n",
      "|           Location |/home/jovyan/spar...|       |\n",
      "|            External|               false|       |\n",
      "|       Transactional|                true|       |\n",
      "|           Streaming|               false|       |\n",
      "|   Table Block Size |             1024 MB|       |\n",
      "|Table Blocklet Size |               64 MB|       |\n",
      "|             Comment|                    |       |\n",
      "|     Bad Record Path|                    |       |\n",
      "|         Date Format|                    |       |\n",
      "|    Timestamp Format|                    |       |\n",
      "|Min Input Per Nod...|                0.0B|       |\n",
      "+--------------------+--------------------+-------+\n",
      "only showing top 20 rows\n",
      "\n"
     ]
    }
   ],
   "source": [
    "spark.sql(\"DESCRIBE FORMATTED carbondata_table_v\").show()"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "5fce784e",
   "metadata": {},
   "source": [
    "## 5. Visualization"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "bfdcae5a",
   "metadata": {},
   "outputs": [],
   "source": [
    "df = spark.sql(\"SELECT age,avg(salary) as avg_salary FROM carbondata_table_v where age>=37 and age <47 group by age \")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "86130c5b",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAaEAAAEkCAYAAACG1Y6pAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8rg+JYAAAACXBIWXMAAAsTAAALEwEAmpwYAAAuG0lEQVR4nO3df7xVVZ3/8ddbKbUaFUWNQMOUUswf5Y3UMjVSUEvM0YmaEs1iMmeqqSm1vo1W80Oz0qzRGSYUMH8xakoWIaL2wwS8aP5AQ0lNr6DgoOj0A0U/3z/WOrHv4dwf+3Lu3Zd738/H4zzOOWvvtfdnX/R+7lp77bUUEZiZmVVhs6oDMDOzwctJyMzMKuMkZGZmlXESMjOzyjgJmZlZZZyEzMysMk5CZtarJJ0kKSSdVHUs1v84CdkmR9JX8i+1kPSWquMxs55zErJNiiQBpwC1p6w/WWE4ZraRnIRsU3MEsCswA3gamCzp1dWGZGY95SRkm5pay+e/gcuBYcAHiztImpu76vZtdABJk/L28+rKt5P075IelPQnSWskzZd0RIN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BHiFNAjiQGD7iNiyVy/UrAHfEzKrWETcK+kw4F9ID6gOAe4hPUj6HCkJFfe/TdIhef+jc/FC4DDgb/P35+vqzM/J7p+A8aSuuReB5aTE1agr0KzXuSVkNoBIuh14J7BNRPyh6njMuuJ7QmabGEmvkbRtg/KTSAMTbnICsk2FW0JmmxhJe5BGyc0jzQE3hPQQ67tJ3XcHRcSDlQVoVoKTkNkmJs8Fdx5p+PbrSQ+yPgXcDPxroymAzPorJyEzM6uM7wmZmVllnITMzKwyTkJmZlYZJyEzM6uMk5CZmVXm/wMeLvADZuw6rQAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "import numpy as np\n",
    "import matplotlib.pyplot as plot\n",
    "pd = df.toPandas()\n",
    "plot.bar(pd[\"age\"], pd[\"avg_salary\"], color='blue')\n",
    "plot.title('Average salary', fontsize=20)\n",
    "plot.xlabel('age', fontsize=20)\n",
    "plot.ylabel('Average salary', fontsize=20)\n",
    "plot.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "b2c67437",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.4"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
